package com.qmscy.sparrow.common.util;

import com.qmscy.sparrow.common.constant.AssertMessage;
import org.springframework.util.Assert;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 时间转换工具
 *
 * @Author: wangxiaonan
 * @Date: 2019/1/6
 **/
public class DateConvertUtil {

    private static final String SALT_PATTERN = "yyyyMMdd";

    public static String getSaltStr(Date date) {
        Assert.notNull(date, AssertMessage.NOT_NULL_PARAM);
        SimpleDateFormat sdf = new SimpleDateFormat(SALT_PATTERN);
        return sdf.format(date);
    }

}